package gui;
import java.util.Iterator;

import java.util.ArrayList;

import jess.*;

public class Main {
    public static void main(String[] argv) throws JessException {
    	ArrayList<Qualities> cualidades= new ArrayList<Qualities>();
    	cualidades.add(new Qualities(0, 75, 80, 60, 50, 70, 60, 70, 70, 70, 70, 70, 0));
    	cualidades.add(new Qualities(1, 80, 50, 60, 50, 80, 60, 70, 70, 70, 70, 70, 0));
    	cualidades.add(new Qualities(2, 60, 70, 80, 50, 80, 60, 70, 70, 70, 70, 70, 0));
    	
    	QualitiesPriorities priorities= new QualitiesPriorities("comunication","computation_knowledge","solving_problems");
    	
    	int suma;
    	
    	
    	
        Rete engine;
        //engine.reset();        
        //engine.batch("gui/cualidades.clp");        
        //engine.addAll(cualidades);
        
        for(int i=0;i<cualidades.size();i++){
        	System.out.println("\n Entro al for "+i);
        	
        	suma=0;     	
        	engine = new Rete();          
            engine.batch("gui/cualidades.clp");
                  	
        	engine.add(cualidades.get(i));
        	engine.add(priorities);
        	engine.run();
        	
            Iterator iter1=engine.getObjects(new Filter.ByClass(Integer.class));
            while (iter1.hasNext()) {
            	int num=(int)iter1.next();
            	suma=suma+num;
                System.out.println("El total es "+suma);
            }
        	
            
            Iterator iter=engine.getObjects(new Filter.ByClass(Results.class));
                
            while (iter.hasNext()) {
            	Results a=(Results)iter.next();
                System.out.println("El id es "+a.idPerson+" Total es "+a.totalQualities);
            }
            
            
         }
        
        
        
        
        
  
        
        
    }
}